Skip to main content

TokenFarmFacet

Token Farm concerns creating and removing of positions from various created pools, as well as the associated getters for {UserInfo} and {PoolInfo}

Functions

add

Adds a new liquidity pool to the protocol

Declaration

  function add(
contract IERC20[] tokens,
uint256 allocPoint,
address[] withUpdate,
bool validNFTs
) public onlyOwner

Modifiers:

Modifier
onlyOwner

Args:

ArgTypeDescription
tokenscontract IERC20[]tokens to be added to the pool, can be one or many (only currently tested for max 2)
allocPointuint256allocation points for pool. This determines what proportion of SDEX is given to this pool every block. allocPoint / TotalAllocPoint = proportion of sdexPerBlock
withUpdateaddress[]runs the massUpdatePool option on execution to update all pool states
validNFTsboollist of addresses of nft rewards that are valid for this pool

changeValidNFTsForPool

No description

Declaration

  function changeValidNFTsForPool(
) public onlyOwner

Modifiers:

Modifier
onlyOwner

isValidNFTForPool

No description

Declaration

  function isValidNFTForPool(
) public returns (bool)

Modifiers:

No modifiers

deposit

Used to deposit a users tokens in a pool for a specific time. Opens up a position in the pool for the amounts given for the time staked. Users with NFT rewards attach here.

Declaration

  function deposit(
uint256 pid,
uint256[] amounts,
uint256 blocksAhead,
address nftReward,
uint256 nftid
) public

Modifiers:

No modifiers

Args:

ArgTypeDescription
piduint256Pool Id
amountsuint256[]Array of amounts of each token, consult pool at pid for order and number
blocksAheaduint256the number of blocks in the future one wants to commit
nftRewardaddressaddress of nft reward token, address(0) for no NFT
nftiduint256The id of the nft at the nft address, 0 for noNFT

withdraw

Withdraws a users tokens from a pool by position. Currently a no partial liquiditations are permitted, a withdraw before the stake time is subject to a penalty. If only 50% of time has passed, only 50% of funds are returned, and all these tokens, and accrued SDEX is sent to the penalty pool as a gift for future stakers who complete their stakeTime. Withdrawing after the stake time returns all tokens, accrued Sdex and an NFT gift from the penalty pool

Declaration

  function withdraw(
uint256 pid,
uint256 positionid
) public

Modifiers:

No modifiers

Args:

ArgTypeDescription
piduint256pool id
positioniduint256id of position to withdraw

poolLength

Getter function for the amount of pools in the protocol

Declaration

  function poolLength(
) external returns (uint256)

Modifiers:

No modifiers

Returns:

TypeDescription
poolLengththe amount of pools

poolInfo

Getter function for the information of a pools

Declaration

  function poolInfo(
uint256 pid
) external returns (struct PoolInfo)

Modifiers:

No modifiers

Args:

ArgTypeDescription
piduint256id for pool

Returns:

TypeDescription
PoolInfoInformation of the pools current state

userInfo

Returns the Information of a user based on a specific pool, positions are found here.

Declaration

  function userInfo(
uint256 pid,
address user
) public returns (struct UserInfo)

Modifiers:

No modifiers

Args:

ArgTypeDescription
piduint256the id of a pool
useraddressaddress of the user

Returns:

TypeDescription
UserInfoInformation of the user

Events

Add

No description

Deposit

No description

Withdraw

No description

PoolUpdateNFT

No description